import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:yt_devops/components/app_bar/app_bar_widget.dart';
import 'package:yt_devops/components/brn/brn_bottom_button_panel.dart';
import 'package:yt_devops/components/log_utils.dart';
import 'package:yt_devops/pages/devices/device_list/device_widget.dart';
import 'package:yt_devops/resources/str_res_keys.dart';
import 'package:yt_devops/styles/styles.dart';
import 'scan_device_result_controller.dart';

class ScanDeviceResultPage extends GetView<ScanDeviceResultController> {
  const ScanDeviceResultPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    Log.d('ScanDeviceResultPage==');
    return Scaffold(
      appBar: AppBarWidget.defaultAppBar(ResKey.addNewDevice.tr),
      body: Column(children: [
        if (controller.device != null) DeviceWidget(controller.device!),
        Expanded(
            child: Align(
          alignment: Alignment.bottomCenter,
          child: !controller.isProductManage()
              ? YtBrnBottomButtonPanel(
                  mainButtonName: ResKey.seeDetail.tr,
                  mainButtonOnTap: () {
                    controller.toDeviceDetail();
                  },
                )
              : YtBrnBottomButtonPanel(
                  mainButtonName: ResKey.save.tr,
                  mainButtonOnTap: () {},
                  secondaryButtonName: ResKey.cancel.tr,
                  secondaryButtonOnTap: () => Get.back(),
                  secondaryButtonBorder: Border.all(color: Colour.dividerColor),
                ),
        ))
      ]),
    );
  }
}
